package week_home_work02;

import java.util.Scanner;

/**
 * @author zdl
 * @date 2024/11/22
 */
public class Demo30 {
    public static void main(String[] args) {
        //输出一个数字的每一位的平方之和。
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个整数：");
        int num = sc.nextInt();
        int num1 = num;
        int sum = 0;
        while (num != 0){
            sum += (num % 10) * (num % 10);
            num /= 10;
        }
        System.out.println(num1+"各位数的平方和为："+sum);
    }
}
